<div class="bg-light lter b-b wrapper-md">
    <h4 class="m-n font-thin">品牌连锁店管理</h4>
</div>

<div class="wrapper-md ng-scope" ng-controller="chainCtrl">

    <script type="text/ng-template" id="updateUserStatus.html">
        <div ng-include="'tpl/systemSetting/merchants_update_status.html'"></div>
    </script>
    <script type="text/ng-template" id="merchantsAudit.html">
        <div ng-include="'tpl/chain/chain_audit.html'"></div>
    </script>

    <div class="panel panel-default">
        <div class="row wrapper">
            <div class="col-sm-9">
                <form class="form-inline ng-pristine ng-valid">
                    <div class="form-group">
                        <label class="control-label">品牌连锁名称</label>
                        <input type="text" ng-model="chain.name" class="input-sm form-control">
                    </div>
                    <div class="form-group">
                        <label class="control-label">状态</label>
                        <select class="input-sm form-control" ng-model="chain.auditStatus">
                            <option value="">全部</option>
                            <option value="0">待审核</option>
                            <option value="1">审核不通过</option>
                            <option value="2">审核通过</option>
                        </select>
                    </div>
                    <button ng-click="query()" class="btn btn-sm btn-default">查询</button>
                </form>
            </div>
            <!--          <div class="col-sm-3">
                          <div class="pull-right">
                              <button class="btn btn-sm btn-info" ui-sref="app.merchantsAdd">新增商户</button>
                          </div>
                      </div>-->
            <div class="clearfix"></div>
        </div>
        <div class="table-responsive" ng-controller="updateMerchantsCtrl">
            <table class="table table-striped b-t b-light">
                <thead>
                    <tr>
                        <th>名称</th>
                        <th>联系人</th>
                        <th>联系电话</th>
                        <th>行业</th>
                        <th>让利值(%)</th>
                        <th>套餐</th>
                        <th>是否分销</th>
                        <th>是否返利</th>
                        <th>审核状态</th>
                        <th>到期时间</th>
                        <th width="200" class="text-center">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="c in list">
                        <td>{{c.name}}</td>
                        <td>{{c.linkman}}</td>
                        <td>{{c.mobilePhone}}</td>
                        <td>{{c.industryName}}</td>
                        <td>{{c.profit}}</td>
                        <td>{{c.setMealName}}</td>
                        <td>
                            <span class="badge bg-danger " ng-if="c.isOpenSell == 0">未开启</span>
                            <span class="badge bg-success" ng-if="c.isOpenSell == 1">已开启</span>
                        </td>
                        <td>
                            <span class="badge bg-danger" ng-if="c.isOpenRebate == 0">未开启</span>
                            <span class="badge bg-success" ng-if="c.isOpenRebate == 1">已开启</span>
                        </td>
                        <td>
                            <span class="badge bg-danger" ng-if="c.auditStatus == 0">待审核</span>
                            <span class="badge bg-danger" ng-if="c.auditStatus == 1">审核不通过</span>
                            <span class="badge bg-success" ng-if="c.auditStatus == 2">审核通过</span>
                        </td>
                        <td>{{c.expireTime.split(" ")[0]}}</td>
                        <td class="t-btns text-right">
                            <a class="btn btn-sm btn-success" ui-sref="app.chainView({chainId:c.id})" target="_blank">查看</a>
                            <button class="btn btn-sm btn-info" ui-sref="app.chainEdit({chainId:c.id})">修改</button>
                            <div class="btn-group dropdown" dropdown="">
                                <button class="btn btn-sm btn-default" dropdown-toggle=""
                                        aria-haspopup="true" aria-expanded="false">更多 <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu">
                                    <li><a href="" ui-sref="app.chainShop({chainId:c.id})">查看店铺</a></li>
                                    <li><a href="" ui-sref="app.chainGoodsAudit({chainId:c.id})">查看商品</a></li>
                                    <li><a ng-click="openChainAudit(c.id,c.name,2)"  ng-if="c.auditStatus == 0 || c.auditStatus==1">审核通过</a></li>
                                    <li><a ui-sref="app.chainAuditFail({id:c.id})"  ng-if="c.auditStatus == 0">审核不通过</a></li>
                                </ul>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <footer class="panel-footer">
            <div class="row">
                <div class="col-sm-4 hidden-xs">
                    <!--<button class="btn btn-sm btn-default">批量冻结</button>
                    <button class="btn btn-sm btn-default">批量删除</button>-->
                </div>
                <div class="col-sm-4 text-center">
                    <small class="text-muted inline m-t-sm m-b-sm">显示第 {{startRow}} 至 {{endRow}} 项结果，共 {{totalItems}} 项</small>
                </div>
                <div class="col-sm-4 text-right text-center-xs">
                    <pagination boundary-links="true" total-items="totalItems" ng-model="currentPage"
                                ng-change="pageChanged()" max-size="{{maxPageRow}}" class="pagination-sm m-t-none m-b"
                                previous-text="上一页" next-text="下一页"
                                first-text="首页" last-text="尾页"></pagination>
                </div>
            </div>
        </footer>
    </div>
</div>
